<template>
	<view>

		<cu-custom :bgColor="theme" :isBack="true" textColor="#000000">
			<block slot="backText">返回</block>
			<block slot="content">重设密码</block>
		</cu-custom>
		
		<view style="width: 96%;margin: 0 auto;margin-bottom: 60rpx;">
			<input 
				class="uni-input" 
				type="text" 
				value="" 
				placeholder="输入旧密码" 
				placeholder-style="color:#C7C7C7;padding-left: 25rpx;" 
				v-model="oldpassword"
			/>
			<input 
				class="uni-input" 
				type="text" 
				value="" 
				placeholder="输入新密码" 
				placeholder-style="color:#C7C7C7;padding-left: 25rpx;" 
				v-model="newpassword" 
			/>
			<input 
				class="uni-input" 
				type="text" 
				value="" 
				placeholder="输入确认密码" 
				placeholder-style="color:#C7C7C7;padding-left: 25rpx;"
				v-model="renewpassword" 
			/>
			<view class="py-2 px-2">
				<button class="bg-main text-white" style="border-radius: 50rpx; border: 0;" 
				type="primary" :disabled="disabled" @click="submit">设置</button>
			</view>
		</view>
	
	</view>
</template>
<script>
	export default {
		data() {
			return {	
				CustomBar: this.CustomBar,
				StatusBar: this.StatusBar,
				theme: app.globalData.theme.backgroundColor, //全局颜色变量
				
				oldpassword:"",
				newpassword:"",
				renewpassword:"",
			}
		},
		computed:{
			disabled(){
				return this.oldpassword == '' || this.newpassword == '' || this.renewpassword == '';
			}
		},
		methods: {
			// 验证
			check(){
				if(this.newpassword !== this.renewpassword){
					uni.showToast({
						title: '两次密码输入不一致'
					});
					return false;
				}
				return true;
			},
			submit(){
				if(!this.check()){
					return;
				}
			}
		}
	}
</script>
<style>
	.uni-input{
		margin: 25rpx 0 25rpx 0;
		height: 65rpx;
		line-height: 65rpx;
		border-radius: 5px;
		
	}
</style>
